package servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.Articles;
import bean.Participate;
import bean.ParticipateAdm;
import bean.SearchArt;

@SuppressWarnings("serial")
public class ArtManJoinServlet extends HttpServlet{
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		long id = Long.parseLong(req.getParameter("id2"));
		SearchArt sr = new SearchArt();
		Articles art = sr.searchById(id);
		
		HttpSession session = req.getSession();
		long mid = (Long) session.getAttribute("id");
		
		ParticipateAdm pa = new ParticipateAdm();
		Participate part = pa.searchOnePartByMem(mid, art);
		
		req.setAttribute("oneArt", art);
		req.setAttribute("onePart", part);
		req.getRequestDispatcher("./member/myjoin.jsp").forward(req, resp);
	}
}
